package models.helpers;

import java.io.File;
import java.io.FilenameFilter;
import java.text.MessageFormat;

public class ImagenameFilter implements FilenameFilter {
        private String[] pictureName;

        public ImagenameFilter(int imageId){
            pictureName = new String[2];
            pictureName[0] = MessageFormat.format("{0}.jpg", imageId);
            pictureName[1] = MessageFormat.format("{0}.png", imageId);
        }
        public boolean accept(File dir, String name) {
            if (pictureName[0].equals(name) || pictureName[1].equals(name)){
                return true;
            }
            return false;
        }
    }
